package cbbx_sm.parser;

/**
 * This class represent an entity in a frame.
 * The entity has an Id and three bounding boxes: overall, high, medium, low.
 * E.g., if the entity is a person, high bbox is the head, medium bbox is the
 * body, low bbox contains the legs.
 * 
 * @author Alessio Della Motta - University of California, Irvine
 */
public class Entity {
	private String entityId;
	private BoundingBox[] boxes = null;
	
	public Entity (String entityId, BoundingBox[] boxes){
		if (entityId == null ||boxes == null || boxes.length != 4 ||
				boxes[0] == null || boxes[1] == null || boxes[2] == null || boxes[3] == null){
			System.out.println("ERRORE CREAZIONE Entity");
//				throw new RuntimeException("Unconsistent Frame!");
		}
		
		this.entityId = entityId;
		this.boxes = boxes;
	}
	
	public BoundingBox[] getBoxes() {
		return boxes;
	}
	
	public String getEntityId(){
		return entityId;
	}
	
	@Override
	public String toString(){
		StringBuffer str = new StringBuffer();
		str.append("Id: " + entityId + "\n");
		str.append("Overall-BBox: " + boxes[0].toString() + "\n");
		str.append("High-BBox: " + boxes[1].toString() + "\n");
		str.append("Medium-BBox: " + boxes[2].toString() + "\n");
		str.append("Low-BBox: " + boxes[3].toString() + "\n");
		
		return str.toString();
	}
}
